package com.chif.goingplus.controller;

import com.chif.goingplus.aop.exception.ErrorCode;
import com.chif.goingplus.aop.exception.GlobalException;
import org.springframework.jdbc.BadSqlGrammarException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;

/**
 * AOP统一异常测试
 */
@RestController
public class ExceptionController {

    @RequestMapping("/sQLException")
    public String SQLException(){
        throw new BadSqlGrammarException("123","sql",new SQLException("1"));
    }



    @RequestMapping("/globalException")
    public String GlobalException(){
        throw new GlobalException(ErrorCode.INTERNAL_SERVICE_ERROR);
    }

}
